from django.shortcuts import render, redirect
from django.contrib import auth
from api.utils.common import MyResponse
from django.http import JsonResponse
from api import models
from django.db.models import F
import datetime


# Create your views here.

def index(request):
    acts = models.Club_Activities.objects.filter(state=1, max_number__gt=F('now_number'),
                                                 enroll_starttime__lte=datetime.datetime.now(),
                                                 enroll_endtime__gte=datetime.datetime.now())
    return render(request, 'index.html', locals())


def error(request):
    return render(request,'error.html')
